using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Windows.Forms;

using KontaktIM.Network;

[assembly: log4net.Config.XmlConfigurator(Watch = true)]

namespace KontaktIM.GUI
{
	public partial class Form1 : Form
	{
		private static readonly log4net.ILog _log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
		private string _sendParams = "";
		private string curval;
		private CookieCollection _cookies = null;
		private string _referer = null;
		private string _login = "";
		private string _passwd = "";
		private NetworkManager _netManager;
		
		public Form1()
		{
			InitializeComponent();
			_netManager = new NetworkManager();
			_netManager.Authorize(_login, _passwd);
		}

		private void _timer_Tick(object sender, EventArgs e)
		{
			HttpWebResponse httpWebResponse = _netManager.PostMessage("http://vkontakte.ru/id3468513");
			if (httpWebResponse == null) 
				return;
			Stream receiveStream = httpWebResponse.GetResponseStream();
			Encoding encode = System.Text.Encoding.Default;
			// Pipes the stream to a higher level stream reader with the required encoding format. 
			StreamReader readStream = new StreamReader(receiveStream, encode);
			string ret = readStream.ReadToEnd();
			httpWebResponse.Close();
			_log.Error(ret);
		}

		
		

		
		private void Form1_FormClosing(object sender, FormClosingEventArgs e)
		{

		}
	}
}